package com.zhaopin.mianshi;

import java.util.concurrent.CountDownLatch;

/**
 * @author yin.peide
 * @date 2021-05-07 18:23
 */
public class Work implements Runnable{

    private CountDownLatch latch;


    public Work(CountDownLatch latch) {
        this.latch = latch;
    }


    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + ": 开始执行。。。");
        try {
            Thread.sleep(2000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            System.out.println(Thread.currentThread().getName() + ": 执行结束。。。");
            latch.countDown();
        }
    }
}
